<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>#SITE("title") 管理平台</title>
#include("/admin/_common/head.html")
<link rel="icon" type="image/x-icon" href="#SITE('icon')">
<link rel="shortcut icon" type="image/x-icon" href="#SITE('icon')">
<!-- 布 局 样 式 -->
<link rel="stylesheet" href="#CTX()/pear/admin/css/admin.css?_v=#VERSION()" />
<!-- 加 载 样 式 -->
<link rel="stylesheet" href="#CTX()/pear/admin/css/loader.css?_v=#VERSION()" />
</head>
<!-- 结 构 代 码 -->
<body class="layui-layout-body pear-admin">
    <!-- 布 局 框 架 -->
    <div class="layui-layout layui-layout-admin">
        <!-- 顶 部 样 式 -->
        <div class="layui-header">
            <!-- 菜 单 顶 部 -->
            <div class="layui-logo">
                <!-- 图 标 -->
                <img class="logo">
                <!-- 标 题 -->
                <span class="title">#SITE("title")</span>
            </div>
            <!-- 顶 部 左 侧 功 能 -->
            <ul class="layui-nav layui-layout-left">
                <li class="collapse layui-nav-item"><a href="#" class="layui-icon layui-icon-shrink-right"></a></li>
                <li class="refresh layui-nav-item"><a href="#" class="layui-icon layui-icon-refresh-1" loading = 600></a></li>
            </ul>
            <!-- 多 系 统 菜 单 -->
            <div id="control" class="layui-layout-control"></div>
            <!-- 顶 部 右 侧 菜 单 -->
            <ul class="layui-nav layui-layout-right">
                <li class="layui-nav-item layui-hide-xs">
                    <span style="font-weight: 600; font-size: 24px; color: red;"></span>
                </li>
                <li class="layui-nav-item layui-hide-xs"><a href="#" class="fullScreen layui-icon layui-icon-screen-full">&nbsp;&nbsp;全屏</a></li>
                <li class="layui-nav-item layui-hide-xs"><a href="#CTX()#APP('main_page')" target="_blank" class="layui-icon layui-icon-website">&nbsp;&nbsp;主页</a></li>
                <li class="layui-nav-item user">
                    <!-- 头 像 -->
                    <a class="layui-icon layui-icon-username" href="javascript:;">&nbsp;&nbsp;#(user.nickname??)</a>
                    <!-- 功 能 菜 单 -->
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:changePassword();" class="changePassword"><i class="layui-icon layui-icon-password"></i>&nbsp;&nbsp;修改密码</a></dd>
                        <li class="layui-menu-item-divider"></li>
                        <dd><a href="javascript:void(0);" class="logout"><i class="layui-icon layui-icon-logout"></i>&nbsp;&nbsp;登出系统</a></dd>
                    </dl>
                </li>
                <!-- 主 题 配 置 -->
                <li class="layui-nav-item setting"><a href="#" class="layui-icon layui-icon-more-vertical"></a></li>
            </ul>
        </div>
        <!-- 侧 边 区 域 -->
        <div class="layui-side layui-bg-black">
            <!-- 菜 单 顶 部 -->
            <div class="layui-logo">
                <!-- 图 标 -->
                <img class="logo">
                <!-- 标 题 -->
                <span class="title"></span>
            </div>
            <!-- 菜 单 内 容 -->
            <div class="layui-side-scroll">
                <div id="sideMenu"></div>
            </div>
        </div>
        <!-- 视 图 页 面 -->
        <div class="layui-body">
            <!-- 内 容 页 面 -->
            <div id="content"></div>
        </div>
        <!-- 页脚 -->
        <div class="layui-footer layui-text">
            <span class="left">
                <span>
                    <a href="https://gitee.com/gollyhu" target="_blank">作者</a>
                </span>
            </span>
            <span class="center">
                <a href="https://gitee.com/gollyhu/youcan-solon" target="_blank">Gitee 仓库</a>
            </span>
            <span class="right">
                <a href="http://beian.miit.gov.cn/" target="_blank">#SITE("icp")</a>
            </span>
        </div>
        <!-- 遮 盖 层 -->
        <div class="pear-cover"></div>
        <!-- 加 载 动 画 -->
        <div class="loader-main">
            <!-- 动 画 对 象 -->
            <div class="loader"></div>
        </div>
    </div>
    <!-- 移 动 端 便 捷 操 作 -->
    <div class="pear-collapsed-pe collapse">
        <a href="#" class="layui-icon layui-icon-shrink-right"></a>
    </div>

#include("/admin/_common/foot.html")
<script src="#CTX()/admin/js/watermark.js?_v=#VERSION()"></script>

<script type="text/javascript">
layui.use(['jquery', 'admin'], function() {
    var $ = layui.jquery, admin = layui.admin;
    
    // 模块操作路径
    var MODULE_PATH = "#CTX()/admin/";
    
    admin.setConfigType("json"); // 从站点配置中获取配置文件类型：json或yml
    admin.setConfigPath(MODULE_PATH + "/config"); // 从站点配置中获取配置文件地址
    
    /*
     * 登出逻辑
     */
    admin.logout(() => {
        logout();
        // 注销逻辑 返回 true / false
        return true;
    });

    window.logout = () => {
        $.operate.save(
            MODULE_PATH + 'logout',
            {},
            'delete',
            (result) => {
                if (result.code === RESULT_CODE.SUCCESS) {
                    $.modal.alertSuccess('登出成功！');
                }
                location.href = MODULE_PATH + 'login';
            }
        );
    };

    /*
     * 打开修改密码页面
     */
    window.changePassword = () => {
        $.modal.popupEditor(
            '<i class="layui-icon layui-icon-password"></i>&nbsp;&nbsp;修改密码',
            MODULE_PATH + 'changePassword',
            '480px',
            '360px',
            {
                buttonId: 'submit-button',
                url: MODULE_PATH + "changePassword",
                method: 'put',
                callback: (index, layero, that, result) => {
                    if (result.code === RESULT_CODE.SUCCESS) {
                        $.modal.alertSuccess('操作成功！');
                    } else if (result.code != RESULT_CODE.CANCEL) {
                        $.modal.alertError('操作失败！');
                    }
                },
            },
        );
    }
    
    /*
     * 左上角标题被点击时的操作
     */
    $(".layui-logo").click(() => {
        goHome();
    });
    
    /*
     * 打开首页页面
     */
    window.goHome = () => {
    	top.layui.admin.jump('2', "<i class='layui-icon layui-icon-home'></i>&nbsp;首页" , '#CTX()/admin/home', true);
    }
    
    $(document).ready(() => {
        admin.render();

        /*
         * 显示水印
         */
        if ("#APP('show_watermark')" == "true"){
            watermark.show({
                content: "Youcan-Solon<br>#(user.nickname??)",
                height: 80, width: 300, rotate: 345, opacity: 0.05, fontSize: 1.0
            });
        }
    });
})
</script>
</body>
</html>
